﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace YF_Music.Modules.APP_My.Controls
{
  /// <summary>
  /// FavoriteCard.xaml 的交互逻辑
  /// </summary>
  public partial class FavoriteCard : UserControl
  {
    public FavoriteCard()
    {
      InitializeComponent();
    }
    public Drawing Icon
    {
      get => (Drawing)GetValue(IconProperty);
      set => SetValue(IconProperty, value);
    }

    public static readonly DependencyProperty IconProperty =
        DependencyProperty.Register("Icon", typeof(Drawing), typeof(FavoriteCard), new PropertyMetadata(null));

    public ImageSource Image1Source
    {
      get => (ImageSource)GetValue(Image1SourceProperty);
      set => SetValue(Image1SourceProperty, value);
    }

    public static readonly DependencyProperty Image1SourceProperty =
        DependencyProperty.Register("Image1Source", typeof(ImageSource), typeof(FavoriteCard), new PropertyMetadata(null));

    public ImageSource Image2Source
    {
      get => (ImageSource)GetValue(Image2SourceProperty);
      set => SetValue(Image2SourceProperty, value);
    }

    public static readonly DependencyProperty Image2SourceProperty =
        DependencyProperty.Register("Image2Source", typeof(ImageSource), typeof(FavoriteCard), new PropertyMetadata(null));

    public string Label
    {
      get => (string)GetValue(LabelProperty);
      set => SetValue(LabelProperty, value);
    }

    public static readonly DependencyProperty LabelProperty =
        DependencyProperty.Register("Label", typeof(string), typeof(FavoriteCard), new PropertyMetadata("收藏"));

    public int Count
    {
      get => (int)GetValue(CountProperty);
      set => SetValue(CountProperty, value);
    }

    public static readonly DependencyProperty CountProperty =
        DependencyProperty.Register("Count", typeof(int), typeof(FavoriteCard), new PropertyMetadata(0));


    public ICommand ClickCommand
    {
      get => (ICommand)GetValue(ClickCommandProperty);
      set => SetValue(ClickCommandProperty, value);
    }

    public static readonly DependencyProperty ClickCommandProperty =
        DependencyProperty.Register("ClickCommand", typeof(ICommand), typeof(FavoriteCard), new PropertyMetadata(null));

  

    private void OnCardClicked(object sender, MouseButtonEventArgs e)
    {
      if (ClickCommand?.CanExecute(null) == true)
      {
        ClickCommand.Execute(null);
      }
    }
  }
}
